public class MoveZeroes {

    public static void solution(int[] nums){
        int zero=0;
        for (int i = 1; i < nums.length; i++) {
            if(nums[i] !=0&&nums[zero]==0){
                int temp=nums[i];
                nums[i]=nums[zero];
                nums[zero]=temp;
            }
            if(nums[zero]!=0){
                zero++;
            }
        }

    }

    public static void main(String[] args) {
        int[] nums=new int[]{0,1,0,3,12};
        solution(nums);
    }
}
